//
//  DBManage.h
//  UHealth
//
//  Created by gjtxz on 15/1/8.
//  Copyright (c) 2015年 gjtx. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "UserObj.h"
#import "BSMainObj.h"
#import "BSDataObj.h"
#import "LogDataObj.h"
#import "UserRecordObj.h"
#import "UserDailyObj.h"
#import "BodyTemperatureObj.h"

#define kUserId                     @"UserId"
#define kFamID                      @"FamID"   //famID
#define kDeviceID                   @"DeviceID"
#define kSensorID                   @"SensorID"

#define kYunTemperatureTable        @"YunBodyTemperatureMainTable" //云端体温表
#define kIsDownloaded               @"isDownloaded"


#define kTemperatureTable           @"BodyTemperatureMainTable" //体温表
#define kBodyTemperatureId          @"BodyTemperatureId"
#define kUserName                   @"UserName"
#define kMeasureDate                @"MeasureDate"
#define kBodyTemperatureValue       @"BodyTemperatureValue"
#define kMeasureIdentifier          @"MeasureIdentifier"
#define kIsUploaded                 @"isUploaded"


#define kLastFamID                  @"LastFamID"//默认用户ID
#define kLastUserID                 @"LastUserID"
#define kLastSensorID               @"LastSensorID"

#define kFirstUser                  @"firstUser"//主用户


@interface DBManage : NSObject
{
    UserObj   *_firstUser;
}

@property (nonatomic,strong)UserObj   *firstUser;

+ (DBManage *)sharedManager;

-(UserObj *) getUserWithID:(int)ID;//获取某个用户
-(UserObj *) getDefUser;//数据库获取默认用户信息


//创建表
- (BOOL)createTableWithName:(NSString *)tableName;
//增
- (BOOL)insertData:(id)data andTable:(NSString *)tableName;
//删
- (BOOL)deleteDataFromTable:(NSString *)tableName andConditions:(NSString *)conditionStr;
//改
- (BOOL)updateData:(id)data andTable:(NSString *)tableName andConditions:(NSString *)conditionStr;
//查
- (id  )queryDataFromTable:(NSString *)tableName andConditions:(NSString *)conditionStr;

@end
